export default class MySet {
    

    #items = {}

    /**
     * add data to set
     * @param {*} data 
     * @returns true | false
     */
    add(data) {
        if (!this.has(data)) {
            this.#items[data] = data
            return true
        }
        return false
    }

    delete(data) {
        if(this.has(data)){
            delete this.#items[data]
            return true
        }
        return false
    }

    has(data) {
        return data in this.#items
    }

    clear() {
        this.#items = {}
    }

    size() {
        return Object.keys(this.#items)
    }

    values() {
        return Object.values(this.#items)
    }
}